﻿using Microsoft.Practices.Unity;
using Moop.UI.ViewModels;
using System.Windows;

namespace Moop.UI.Views
{
    public partial class MainView : Window
    {
        public MainViewModel MainViewModel { get; private set; }
        public GridLength InnerGridFirstColumnWidth { get; set; }

        public MainView([Dependency] MainViewModel mainViewModel)
        {
            InitializeComponent();            
            MainViewModel = mainViewModel;
            DataContext = MainViewModel;   
        }

        //TODO: TreeView using Data Template
        //http://blogs.msdn.com/b/mikehillberg/archive/2009/10/30/treeview-and-hierarchicaldatatemplate-step-by-step.aspx

        private void MainGridSplitter_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (InnerLayoutGrid.ColumnDefinitions[0].Width.Value <= 50.0)
            {
	            InnerLayoutGrid.ColumnDefinitions[0].Width = new GridLength(165.0);
                MainGridSplitter.ToolTip = "Click to Minimize...";
            }
            else
            {
	            InnerLayoutGrid.ColumnDefinitions[0].Width = new GridLength(10.0);
                MainGridSplitter.ToolTip = "Click to Expand...";
            }
        }
    }
}
